package com.clayecloud.lib_common.utils;

public  class MessageUtil<T>
{

    public interface UnionSimpleView {}

    //状态码
    private boolean result;

    private String msg;

    //包含的数据
    private T obj;

    private MessageUtil(boolean result, String msg) {
        this.result = result;
        this.msg = msg;
    }

    public static <T> MessageUtil<T> success(String str)
    {
        return new MessageUtil<T>(true,str==null?"操作成功":str);
    }


    public static <T> MessageUtil<T> fail(String str)
    {
        return new MessageUtil<T>(false,str==null?"操作失败":str);
    }

    //添加包含的数据
    public MessageUtil add(T obj)
    {
        this.setObj(obj);
        return this;
    }

    public boolean getResult() {
        return result;
    }

    public void setResult(boolean result) {
        this.result = result;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getObj() {
        return obj;
    }

    public void setObj(T obj) {
        this.obj = obj;
    }
}